pow.ivyclient
Class HeartBeat

java.lang.Object
  extended by pow.ivyclient.HeartBeat
All Implemented Interfaces:
java.lang.Runnable

public class HeartBeat
extends java.lang.Object
implements java.lang.Runnable

thread which send a periodic message to a client or server to say that the connection is still alive (period has to be less than the socket timeout of the the server)

Author:
genin

Constructor Summary
HeartBeat(AES cipher, int webId, java.net.InetAddress srv, int port2send, long heartbeatPeriod)
          define the parameter of the heartbeat message
 
Method Summary
 void run()
          send a periodic heartbeat message
 void stop_thread()
          stop the heartbeat thread by ending the infinite loop
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HeartBeat

public HeartBeat(AES cipher,
                 int webId,
                 java.net.InetAddress srv,
                 int port2send,
                 long heartbeatPeriod)
define the parameter of the heartbeat message

Parameters:
cipher - the way to encrypt message to be send on udp channel
webId - the id of the bus
srv - the ip address of the host hosting the ivy bus
port2send - the udp port on which the heartbeat is sent
heartbeatPeriod - the period of time to send heartbeat message
Method Detail

run

public void run()
send a periodic heartbeat message

Specified by:
run in interface java.lang.Runnable

stop_thread

public void stop_thread()
stop the heartbeat thread by ending the infinite loop